import com.google.gson.Gson;
import com.xingxing.Bean.*;
import com.xingxing.Dao.*;
import com.xingxing.Util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;

import java.io.DataOutput;
import java.sql.SQLException;
import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
//        likeTest();
        User user = UserDao.find("whiteone");
        user.setNickName("whiteone1");
        System.out.println(UserDao.updateNickName(user));
    }


    private static void userTest() {
        User user = new User();
        user.setUserAccount("admin");
        user.setNickName("whiteone");
        user.setUserPassword("123456");
        user.setUserSex("男");
        user.setUserRegion("广西梧州");
        user.setBornDate("2001-01-28");
        user.setIntroduce("Hello");
        user.setUserPhone("123");
//        System.out.println(UserDao.update(user));
    }

    private static void fileTest() {
        ArrayList<File> file;
//        file.setFileID("3");
//        file.setFileName("3");
//        file.setFileType("mp4");
//        file.setFileDirectory("123");
//        FileDao.insert(file);
        file = FileDao.findAll();
        System.out.println(file.size());
    }

    private static void commentTest() {
        ArrayList<Comment> comment1;
        Comment comment = new Comment();
        comment.setCommentID("1");
        comment.setUserAccount("whiteone");
        comment.setCommentText("这条视频还行");
        comment.setVideoID("1");
        System.out.println(CommentDao.update(comment));
//        comment1 = CommentDao.findVideoComment("1");
//        System.out.println(comment1.size());
    }

    private static void videoTest() {
//        Video video = new Video();
//        video.setVideoID("3");
//        video.setUserAccount("whiteone");
//        video.setFileDirectory("aaaa");
//        video.setFileID("1");
//        System.out.println(VideoDao.insert(video));
//        System.out.println(VideoDao.find("1").getFileDirectory());
//        ArrayList<Video> videos;
//        videos=VideoDao.findVideoByUser("whiteone");
//        System.out.println(videos.get(0).getVideoText());
    }

    private static void likeTest() {
//        Likes likes = new Likes();
//        likes.setUserAccount("admin");
//        likes.setVideoID("2");
//        System.out.println(LikesDao.findByVideoID("2").size());
        ArrayList<Video> videos = VideoDao.findVideoByUser("whiteone");
//        if (videos.size() > 0) {
//            String[] str = new String[videos.size()];
//            for (int i = 0; i < videos.size(); i++) {
//                str[i]=videos.get(i).getVideoID();
//            }
//            ArrayList<Likes> likes = LikesDao.findByInSet(str);
//        }
    }
}
